package com.baidu.sms.controller;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.jms.Topic;
import java.util.HashMap;
import java.util.Map;

/**
 * 发送消息
 */
@RestController
public class SmsController {
    //队列模式
    @Autowired
    JmsMessagingTemplate jmsMessagingTemplate;

    //主题模式
    /*@Autowired
    Topic topic;*/
   /* @RequestMapping("list")
    public String list(){
        jmsMessagingTemplate.convertAndSend("springboot-sms","宝贝我爱你！");
        return "宝贝，欢迎你！！";
    }*/
    //Map发送消息
    @RequestMapping("list1")
    public String list1(String phone,String smsCode) {
        Map map = new HashMap();
        map.put("phone",phone);
        map.put("smsCode",smsCode);
        jmsMessagingTemplate.convertAndSend("springboot-sms",map);
        return "..";
    }
}
